<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            background: pink;
            position: fixed;
            left: 50px;
            top: 50px;
        }
        
        /* 进来之前  */
        .animate-enter {
           left: 0  
        }
        /* 进来过程 */
        .animate-enter-active {
            transition: all .5s;
        }
        
        /* 进来完成 */
        .animate-enter-to {
            left: 300px
        }

        .animate-leave {
            left: 300px
        }

        .animate-leave-active {
            transition: all .5s;
        }

        .animate-leave-to {
            left: 1000px;
}
    </style>
</head>
<body>
    <div id="app">
        <button @click="show = !show">切换</button>
        <transition name="animate">
            <div class="box" v-show="show">
            </div>
        </transition>  
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                show: true
            }
        })
    </script>
</body>
</html>